package bist.believeinstep.logic;

import java.util.List;

import bist.believeinstep.domain.User;
import bist.believeinstep.impl.UserTemplate;
import bist.believeinstep.util.Util;

public class UserService {
	private UserTemplate userTemplate;
	
	public UserService(){
		userTemplate = (UserTemplate)Util.getConnection("userTemplate");
	}
	/* method to be used to create a record in User table*/
	public void createUser(User user){
		userTemplate.createUser(user);
	}
	/*method dung de lay 1 user theo id*/
	public User getUser(Integer id){
		return userTemplate.getUser(id);
	}
	public User getUser(String code){
		return userTemplate.getUser(code);
	}
	public List<User> listUser(){
		return userTemplate.listUser();
	}
	/*method dung xoa 1 user*/
	public void deleteUser(Integer userId){
		userTemplate.deleteUser(userId);
	}
	public void deleteUser(String code){
		userTemplate.deleteUser(code);
	}
	/*method dùng update user*/
	public void updateUser(User user){
		userTemplate.updateUser(user);
	}
}
